import React from "react";
import { useNavigate } from "react-router";
import { Dropdown, Space, Avatar } from "antd";
import { SmileOutlined } from "@ant-design/icons";
import avatar from "../../assets/images/avatar.png";

export default function HeadUser() {
  const navigate = useNavigate();
  const logout = () => {
    navigate("/");
  };
  const items = [
    {
      key: "1",
      label: <span className="dropdown-item">退出登录</span>,
      onClick: () => logout(),
    },
  ];

  return (
    <Dropdown
      menu={{
        items,
      }}
    >
      <Space>
        <Avatar size="large" src={avatar} className="pointer" />
      </Space>
    </Dropdown>
  );
}
